var mongoose = require("mongoose");
var db = require("./db.js")

var studentSchema = new mongoose.Schema({       // Schema 结构
    name : {type : String},
    age  : {type : Number},
    sex  : {type : String}
});

studentSchema.statics.Find = function(name, callback){      // 创建静态方法
    this.model('Student').find({name: name}, callback);
}

studentSchema.statics.Update = function(conditions,update,options,callback){    // 创建修改的静态方法
    this.model("Student").update(conditions,update,options,callback);
}

var studentModel = db.model('Student',studentSchema); // Student模型,基于schema创建


module.exports = studentModel